"use strict";
var path = require('path');
var controller = require(path.join(__dirname, '../controler/ImageController.js'));

var koaBody = require('koa-better-body');

module.exports = function(app) {
  app.get('/image/index.html', function * (next) {
    yield controller.index(this, next);
  });

  app.post('/image/upload', koaBody({
    multipart  : true,
maxFieldsSize  : '2mb',
    hash       : 'sha1',
    formidable : {
      uploadDir: path.resolve(__dirname, '../../static/upload')
    }
  }), function * (next) {
    yield controller.upload(this, next);
  });

  app.get('/upload/:picture', function *(next){
    yield controller.convert(this, next);
  });
};

